import React, { Component } from 'react'
import A from './components/A'
import B from './components/B'

// 状态提升
export default class App extends Component {
  state = {
    count: 0,
  }
  changeCount = (count) => {
    // #2 修改了 count
    this.setState({
      count: this.state.count + count,
    })
    // #3 count 一变化，B 组件用到的 count 也就变了（单项数据流）
  }
  render() {
    return (
      <>
        <A changeCount={this.changeCount} />
        <B count={this.state.count} />
      </>
    )
  }
}
